<?php
declare (strict_types=1);

namespace app\course\logic\payment;

use app\course\model\payment\PaymentOrderItem as POIModel;

/**
 * @method group(string $string)
 */
class PaymentOrderItem extends POIModel
{
    public function getWellSaleCourseIds($courseType, $number): array
    {
        $data = app(PaymentOrderItem::class)->whereIn('product_type_id', $courseType)->group('product_id')->field("product_id as id, count(1) as count")->order('count DESC')->limit($number)->select()->toArray();
        return array_column($data, 'id');
    }
}
